const { parse } = require('json2csv');
const fs = require('fs');

let json = { GameType: 2, WriteDate: '2020-02-22 15:55:03' };

const fields = ['GameType', 'WriteDate'];
const opts = { fields };

try {
  const csv = parse(json, opts);
  console.log(csv);
  fs.writeFileSync('./test.csv', csv);
} catch (err) {
  console.error(err);
}
